/*******************************************************************************
 * Copyright 2007, 2009 InnovaSoft SA http://www.innovasoft.biz/
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *       http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/

package biz.innovasoft.nodb;

/**
 * 
 * RepositoryManager configuration.
 * 
 * @author Diego Miranda
 *
 */
public class Configuration {

	private final static String PREVALENCE_ROOT = ".";
	
	private boolean lockedAsTransient;
	private String repositoriesBasePath = PREVALENCE_ROOT + "/prevalence/repos";
	private String lockPath = PREVALENCE_ROOT + "/prevalence/locks";

	public Configuration() {
	}
	
	/**
	 * Returns the path where the locks are located.
	 * 
	 * @return the path.
	 */
	public String getLockPath() {
		return lockPath;
	}

	/**
	 * Sets the location where the locks should be.
	 * 
	 * @param lockPath the path to the directory where the locks are located.
	 * 
	 */
	public void setLockPath(String lockPath) {
		this.lockPath = lockPath;
	}

	/**
	 * Returns the repository path location.
	 * 
	 * @return the repository path location.
	 */
	public String getRepositoriesBasePath() {
		return repositoriesBasePath;
	}

	/**
	 * Sets the base directory where the repositories should be stored.
	 * 
	 * @param repositoriesBasePath the base path location.
	 */
	public void setRepositoriesBasePath(String repositoriesBasePath) {
		this.repositoriesBasePath = repositoriesBasePath;
	}

	/**
	 * Informs if a repository should be open as transient if it is already open by
	 * another JVM.
	 * 
	 * @return true if the repositories should be open as transient.
	 */
	public boolean isLockedRepositoryAsTransient() {
		return lockedAsTransient;
	}

	/**
	 * Indicate to the manager if a repository should be open as transient if the repository
	 * is already locked by another JVM.
	 * 
	 * @param lockedAsTransient true, if the repository should be open as transient.
	 */
	public void setLockedRepositoryAsTransient(boolean lockedAsTransient) {
		this.lockedAsTransient = lockedAsTransient;
	}
	
	
}
